Integrand size = 26, antiderivative size = 80 \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=2 a^2 (A-i B) x-\frac {2 a^2 (i A+B) \log (\cos (c+d x))}{d}-\frac {a^2 (A-i B) \tan (c+d x)}{d}+\frac {B (a+i a \tan (c+d x))^2}{2 d} \]
[Out]
Time = 0.12 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.115, Rules used = {3608, 3558, 3556} \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {a^2 (A-i B) \tan (c+d x)}{d}-\frac {2 a^2 (B+i A) \log (\cos (c+d x))}{d}+2 a^2 x (A-i B)+\frac {B (a+i a \tan (c+d x))^2}{2 d} \]
[In]
[Out]
Rule 3556
Rule 3558
Rule 3608
Rubi steps \begin{align*} \text {integral}& = \frac {B (a+i a \tan (c+d x))^2}{2 d}-(-A+i B) \int (a+i a \tan (c+d x))^2 \, dx \\ & = 2 a^2 (A-i B) x-\frac {a^2 (A-i B) \tan (c+d x)}{d}+\frac {B (a+i a \tan (c+d x))^2}{2 d}+\left (2 a^2 (i A+B)\right ) \int \tan (c+d x) \, dx \\ & = 2 a^2 (A-i B) x-\frac {2 a^2 (i A+B) \log (\cos (c+d x))}{d}-\frac {a^2 (A-i B) \tan (c+d x)}{d}+\frac {B (a+i a \tan (c+d x))^2}{2 d} \\ \end{align*}
Time = 0.49 (sec) , antiderivative size = 58, normalized size of antiderivative = 0.72 \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {a^2 \left (B+4 (i A+B) \log (i+\tan (c+d x))-2 (A-2 i B) \tan (c+d x)-B \tan ^2(c+d x)\right )}{2 d} \]
[In]
[Out]
Time = 0.06 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.95
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {B \left (\tan ^{2}\left (d x +c \right )\right )}{2}-A \tan \left (d x +c \right )+2 i B \tan \left (d x +c \right )+\frac {\left (2 i A +2 B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-2 i B +2 A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) | \(76\) |
default | \(\frac {a^{2} \left (-\frac {B \left (\tan ^{2}\left (d x +c \right )\right )}{2}-A \tan \left (d x +c \right )+2 i B \tan \left (d x +c \right )+\frac {\left (2 i A +2 B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-2 i B +2 A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) | \(76\) |
norman | \(\left (-2 i B \,a^{2}+2 A \,a^{2}\right ) x -\frac {\left (-2 i B \,a^{2}+A \,a^{2}\right ) \tan \left (d x +c \right )}{d}-\frac {B \,a^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {\left (i A \,a^{2}+B \,a^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) | \(87\) |
parallelrisch | \(\frac {-4 i B x \,a^{2} d +2 i A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2}+4 A x \,a^{2} d +4 i B \tan \left (d x +c \right ) a^{2}-B \left (\tan ^{2}\left (d x +c \right )\right ) a^{2}-2 A \tan \left (d x +c \right ) a^{2}+2 B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2}}{2 d}\) | \(98\) |
parts | \(A \,a^{2} x +\frac {\left (2 i A \,a^{2}+B \,a^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {\left (2 i B \,a^{2}-A \,a^{2}\right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}-\frac {B \,a^{2} \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}\) | \(104\) |
risch | \(\frac {4 i a^{2} B c}{d}-\frac {4 a^{2} A c}{d}-\frac {2 a^{2} \left (i A \,{\mathrm e}^{2 i \left (d x +c \right )}+3 B \,{\mathrm e}^{2 i \left (d x +c \right )}+i A +2 B \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}-\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{d}\) | \(120\) |
[In]
[Out]
none
Time = 0.25 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.51 \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left ({\left (i \, A + 3 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (i \, A + 2 \, B\right )} a^{2} + {\left ({\left (i \, A + B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, {\left (i \, A + B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (i \, A + B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]
[In]
[Out]
Time = 0.33 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.52 \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=- \frac {2 i a^{2} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 2 i A a^{2} - 4 B a^{2} + \left (- 2 i A a^{2} e^{2 i c} - 6 B a^{2} e^{2 i c}\right ) e^{2 i d x}}{d e^{4 i c} e^{4 i d x} + 2 d e^{2 i c} e^{2 i d x} + d} \]
[In]
[Out]
none
Time = 0.29 (sec) , antiderivative size = 71, normalized size of antiderivative = 0.89 \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {B a^{2} \tan \left (d x + c\right )^{2} - 4 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{2} - 2 \, {\left (i \, A + B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (A - 2 i \, B\right )} a^{2} \tan \left (d x + c\right )}{2 \, d} \]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 214 vs. \(2 (70) = 140\).
Time = 0.38 (sec) , antiderivative size = 214, normalized size of antiderivative = 2.68 \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (i \, A a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + B a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2 i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + 3 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, A a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + B a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + i \, A a^{2} + 2 \, B a^{2}\right )}}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]
[In]
[Out]
Time = 7.26 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.95 \[ \int (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (2\,B\,a^2+A\,a^2\,2{}\mathrm {i}\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^2\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}+B\,a^2\,1{}\mathrm {i}\right )}{d}-\frac {B\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \]
[In]
[Out]